package com.pb.camera.adapter;

import android.content.Context;
import android.net.wifi.ScanResult;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.pb.camera.R;

import java.util.List;

/**
 * Created by Administrator on 2016/4/8 0008.
 */
public class IPCWifiInfoAdapter extends BaseAdapter {
    private List<ScanResult> mScanResults;
    private Context mContext;

    public  IPCWifiInfoAdapter(List<ScanResult> scanResults, Context context) {
        this.mContext = context;
        this.mScanResults = scanResults;
    }

    @Override
    public int getCount() {
        return mScanResults.size();
    }

    @Override
    public Object getItem(int position) {
        return mScanResults.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null){
            convertView = View.inflate(mContext, R.layout.item_ipc_wifi,null);
        }
        TextView tvWifiName = (TextView) convertView.findViewById(R.id.tv_wifi_name);
        tvWifiName.setText(mScanResults.get(position).SSID);
        return convertView;
    }
}
